package com.emailsystem.emailsystem.service;

import com.emailsystem.emailsystem.domain.Connection;
import com.emailsystem.emailsystem.domain.Email;
//import org.json.simple.JSONObject;
import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;

import java.io.IOException;
import java.util.ArrayList;

@Service
public interface ClientService {
//旧
//    void connect(Connection connection, Email email);
//    void reconnect(Connection connection, Email email);
//    void connect(Connection connection, JSONObject object);
     void connect(Connection connection, JSONObject object);

     /**
      * 远程登录，并且注册到我数据库里面
      * @param account
      * @param password
      * @return
      */
     String connect(String account,String password) throws IOException;
     /**
      * 远程获取邮件
      * @param protocol
      * @param boxType
      * @param account
      * @param password
      * @param begin
      * @param length
      * @throws IOException
      */
     void receiveEmails(String protocol,String boxType,String account, String password,int begin,int length) throws IOException;

     /**
      * 获取数据库email数量
      * @param account
      * @param type
      * @return
      */
     Integer getEmailNumsInPOP3(String account, Character type);
     Integer getEmailNumsInIMAP(String account,String type);
     /**
      * 获取数据库email
      * @param account
      * @return
      */
     ArrayList<Email> getAllEmails(String account,String boxType);
     void updateEmail(String emailID,String type,Boolean state);
     /**
      * 数据库比对远程
      * @param DB_nums
      * @param account
      * @param password
      * @return
      * @throws IOException
      */
     Integer DBvsCurrent(Integer DB_nums, String account, String password)throws IOException ;
     Integer DBvsCurrentInIMAP(Integer DB_nums,String boxType, String account, String password) throws IOException;


     ArrayList<Email> getDeleted(String account);
}
